home *** CD-ROM | disk | FTP | other *** search
/ Enter 2010 January / ENTER_2010_01.iso / Programy / Gry / Base_Invaders_ / BaseInvadersSetup1.3.exe / {app} / Scripts / Campaign3Startup.lua < prev    next >
Encoding:
Text File  |  2007-01-25  |  7.1 KB  |  275 lines

  1.  
  2. function StackerCinematic()
  3.  
  4.     local CinemaInvader  = G.CreateAt( "Stacker", Vector3( 125, 0, 130 ) );
  5.     CinemaInvader.TurnOffAI()
  6.     
  7.     Camera.CinemaMove( Vector3(170,15,170), Vector3(126,10,130), 2 );
  8.     --Camera.CinemaLookAt( CinemaInvader );
  9.     GameWait(2)
  10.     
  11.     G.SayPhraseScript( "Must attack ..." , CinemaInvader );
  12.     GameWait(2)
  13.  
  14.     G.SayPhraseScript( "But So Tired ..." , CinemaInvader );
  15.     CinemaInvader.ChangeStateScript( 5 ); -- Special
  16.     TraitorTalk( "Lazy Stackers. They're big, but they don't do much. Most invaders just hop over them to get past walls. " );
  17.     GameWait(2)
  18.  
  19.     -- Stacker is sleeping
  20.     G.SayPhraseScript( "Zzzz" , CinemaInvader );
  21.     GameWait(5)
  22.  
  23.     -- Drop a rock on him
  24.     local invPos = CinemaInvader.GetPosition();
  25.     G.CreateAt( "WallChunk", invPos + Vector3(1,25,-0.5) );
  26.     GameWait(1)
  27.     
  28.     G.SayPhraseScript( "Oww." , CinemaInvader );
  29.     GameWait(1)
  30.  
  31.     CinemaInvader.ChangeStateScript( 1 ); -- Stopped
  32.     CinemaInvader.TurnOnAI()
  33.     GameWait(2)
  34. end
  35.  
  36.  
  37. --Common Level Start Code
  38. function LevelStartup()
  39.  
  40.     G.Create( "MenuData/HudCog.xml" );
  41.     G.Create( "Data/GameCamera.xml" );
  42.     G.Create( "Data/CursorCog.xml" );
  43.  
  44.     MainLevel = G.Create( "Data/Levels/Campaign3.xml" );
  45.     MainLevel.CreateLevel();
  46.  
  47.     G.SetInvSpeed( 20 );
  48.     HUD.EnterLevel();
  49.     G.SetGameState( InLevel );
  50.     G.EarnPoints( 100 );
  51.     G.SetMaxKills(0);
  52.     
  53.     G.SetLightTime( 5 );
  54.     G.PostP( "None" );
  55.  
  56.     -- gameStartTime = 10000000;
  57.  
  58.     HUD.Message( "VictoryCondition" , "SetText", "Survive the Stacker Invasion!"  );
  59.     HUD.Message( "LossCondition" , "SetText", "If the Tower falls you lose." );
  60.         
  61.     TraitorCanBeHidden = true
  62.  
  63.     G.DisableTrapAll()
  64.  
  65.     G.EnableTrap("wall");
  66.     G.EnableTrap("fan");
  67.     G.EnableTrap("spring");
  68.     G.EnableTrap("hammer");
  69.  
  70.     --TraitorTalk(" ");
  71. end
  72.  
  73. LevelStartup()
  74.  
  75. function LevelIntro()
  76.     
  77.     local tempPos = Tower.GetPosition()
  78.     Camera.LookAtPosition( tempPos )
  79.  
  80.     gameStartTime = GameTime;
  81.  
  82.     ColorTextPopup( "Level 3: Special Delivery", Color(1,1,1,1) )
  83.  
  84.     DisableTraitor()
  85.     GameWait(1.5)
  86.     
  87. --    StartCinematic();
  88. --        StackerCinematic()
  89. --    EndCinematic();    
  90.     
  91.     TraitorTalk("Hey, good morning!  Do you like the new setup?");
  92.     GameWait(6)
  93.     TraitorTalk("I think I put some walls in front of fans by mistake.");
  94.     GameWait(6)
  95.     TraitorTalk("Well, those Bombers yesterday gave me an idea ...");
  96.     GameWait(6)
  97.     
  98.     ColorTextPopup( "New Tool: Bombs!", Color(0.25,0.25,1,1) )
  99.     G.EnableTrap("bomb");
  100.     
  101.     TraitorTalk("These bombs can destroy misplaced traps!");
  102.     GameWait(6)
  103.  
  104.     TraitorTalk("Just hover over the trap, and Click to drop a bomb.");
  105.     GameWait(6)
  106.  
  107.     TraitorTalk("Bombs aren't great versus invaders though.");
  108.     GameWait(6)
  109.     
  110.     TraitorTalk("Look out, I see some invaders coming now!");
  111.  
  112. --    DisableTraitor()
  113.  
  114. --    TraitorTalk("Yeah, I couldn't sleep, so I got workin'.  Pretty good defenses huh?");
  115. --    GameWait(7)
  116. --    TraitorTalk("I'm pretty pleased with myself.  Lets see 'em get through this!");
  117. --    GameWait(7)
  118. --    TraitorTalk("Oh, I see some coming now!  This should be fun.");
  119.  
  120. end
  121.  
  122. function LevelSequence()
  123.     
  124.     -- 1st Have a tower and some walls and let the Basic guys attack.
  125.     Traitor.SetGuiPosition( "TraitorWindow"  , Vector3(0.6, -0.5, 1) );
  126.     
  127.     -- Start Spawning thr guys
  128.     BasicWave = createSpawnStruct()
  129.     
  130.     BasicWave.Prob.Basic    = 2.0;
  131.     BasicWave.Prob.Miner    = 1.0;
  132.     
  133.     BasicWave.SpawnSpeed    = 0.75;
  134.     BasicWave.MaxSpawn        = 15;
  135.     BasicWave.TotalSpawn    = 15;
  136.     BasicWave.GroupPercent    = 0.15;
  137.     BasicWave.GroupSize        = 1;
  138.     BasicWave.WhereToSpawn    = SmallCircleAroundTower
  139.         
  140.     --AddWave( "BasicAttack", BasicWave );
  141.     
  142.     -- Stacker Wave
  143.     StackerWave = createSpawnStruct()
  144.     StackerWave.Prob.Stacker    = 1.5;
  145.     
  146.     StackerWave.SpawnSpeed        = 5.0;
  147.     StackerWave.MaxSpawn        = 20;
  148.     StackerWave.TotalSpawn        = 19;
  149.     StackerWave.GroupPercent    = 0.95;
  150.     StackerWave.GroupSize        = 1;
  151.     StackerWave.WhereToSpawn    = CircleAroundTower
  152.         
  153.     
  154.     AddWave( "BasicAttack", BasicWave )
  155.     G.SetMaxKills(15);
  156.     
  157.     InvadersKilledWait( 15 )
  158.     
  159.     TraitorTalk("What'd I tell ya?  The perfect defense!")
  160.     GameWait(5)
  161.     TraitorTalk("...  Hey, what's that?  Did you hear something?")
  162.     GameWait(6)
  163.     
  164.     StartCinematic();
  165.         StackerCinematic()
  166.     EndCinematic();
  167.     
  168.     InvaderTextPopup( "Stacker" );
  169.     GameWait(1)    
  170.         
  171. --    TraitorTalk("Oh no, they've brought Stackers!")
  172. --    GameWait(4)
  173.     TraitorTalk("They're so heavy, our fans will have no effect on them!")
  174.     GameWait(6)
  175.     
  176.     BasicWave.Prob.Stacker    = 1.0;
  177.     BasicWave.Prob.Spiker    = 1.5;
  178.     BasicWave.TotalSpawn    = 25;
  179.     
  180.     AddWave( "StackerAttack", StackerWave )
  181.     G.SetMaxKills(60);
  182.     
  183.     TraitorTalk("These guys are pretty tough too; they'll survive the fall from a spring trap.")
  184.     GameWait(6)
  185.     TraitorTalk("Place some more hammers, and I'll try to find a new trap.")
  186.         
  187.     InvadersKilledWait(55)
  188.     TraitorTalk("Not many left! Check the Radar for stackers, they might be hiding!");
  189.     WaitForClearEnemies( )
  190.     
  191.     
  192.     TraitorTalk("Here are the blueprints for the spinning axe trap.")
  193.     GameWait(3)    
  194.  
  195.     G.EarnPoints( 70 );
  196.     TrapTextPopup("Spinning Axe")    
  197.     G.EnableTrap("axe");
  198.     GameWait(4)
  199.     TraitorTalk("This Axe trap will damage invaders, and toss them around." )
  200.     GameWait(7)
  201.     --TraitorTalk("Be sure to watch its energy gauge, they wear down over time.")
  202.     TraitorTalk("Place some near the Tower to keep the Stackers away.")
  203.     GameWaitOrMoney(20)
  204.  
  205.     BasicWave.TotalSpawn        = 30;
  206.     StackerWave.TotalSpawn        = 25;
  207.     
  208.     G.SetMaxKills(115);
  209.  
  210.     TraitorTalk("Looks like there's just one last group!")
  211.  
  212.     InvadersKilledWait(115)
  213.     TraitorTalk("Almost all ...");
  214.     WaitForClearEnemies( )
  215.  
  216.     TraitorTalk("Wow, I guess there's no such thing as a perfect defense after all.");
  217.     GameWait(7)
  218.  
  219.     G.SetGameState( Victory );    
  220.     
  221.     TraitorTalk("Get some rest and we'll see what lies in store for us tomorrow.");
  222.     GameWait(7)
  223.     TraitorTalk("Live and learn, huh?  Well, its been a long day.");
  224.     GameWait(6)
  225.     
  226.     --[[
  227.     TraitorTalk("Arrgh! That was brutal.")
  228.     GameWait(4)
  229.     TraitorTalk("I know!")
  230.     GameWait(2)
  231.     ColorTextPopup( "New Trap: Poison Mist!", Color(0,0,0.85,1) )
  232.     G.EnableTrap("poison");
  233.     G.EarnPoints( 25 )
  234.     GameWait(3)
  235.     TraitorTalk("Whew! That's better.  These poison mist traps should help out.")
  236.     GameWait(5)
  237.     TraitorTalk("It produces clouds of poison that slowly kills anyone who inhales it.")
  238.     GameWait(6)
  239.     TraitorTalk("The clouds can be blown around by fans, and even picked up!")
  240.     GameWait(5)
  241.     
  242.     WaitForTimeOrKills( 500, 120 )        
  243.     WaitForClearEnemies( 20 )
  244.     BasicWave.TotalSpawn = 50
  245.     
  246.     TraitorTalk("Oh, I almost forgot: these bombs should come in handy.")
  247.     GameWait(3)
  248.     ColorTextPopup( "New Trap: Bombs!", Color(0,0,0.85,1) )
  249.     G.EnableTrap("bomb");
  250.     GameWait(3)
  251.     
  252.     TraitorTalk("If you drop one onto a trap, it'll get rid of it instantly.")
  253.     GameWait(5)
  254.     TraitorTalk("You can even use them to take out invaders as they come.")
  255.     GameWait(5)
  256.     TraitorTalk("Try it out on some Stackers once they settle down by a wall.")
  257.     GameWait(6)
  258.     
  259.     WaitForTimeOrKills( 500, 170 )
  260.     StopWave( "StackerAttack" )        
  261.     WaitForClearEnemies( 10 )    
  262.     
  263.     TraitorTalk("Good job, that seemed to do the trick!")
  264.     StopWave( "BasicAttack" )
  265.     --StopWave( "KamiAttack" )
  266.     GameWait(3)
  267.     ]]--
  268.         
  269.     
  270. end
  271.  
  272. levelRoutine = coroutine.create(LevelIntro);
  273.  
  274. GMain["LevelUpdate"] = LevelUpdate;
  275.